#include "videorequesttoclient.h"

VideoRequestToClient::VideoRequestToClient(const UserId& requestUserId, const Ip& requestUserIp)
{
    m_messageType = MessageType::VideoRequestToClient;
    m_requestUserId = requestUserId;
    m_requestUserIp = requestUserIp;
}

VideoRequestToClient::VideoRequestToClient(const QJsonObject& jsonObj)
{
    m_messageType = static_cast<MessageType>(jsonObj[JsonKey::TYPE].toInt());
    m_requestUserId = jsonObj[JsonKey::USER_ID].toString();
    m_requestUserIp = jsonObj[JsonKey::USER_IP].toString();
}

QJsonObject VideoRequestToClient::PackJsonData() const
{
    QJsonObject jsonObj;
    jsonObj[JsonKey::TYPE] = static_cast<int>(m_messageType);
    jsonObj[JsonKey::USER_ID] = m_requestUserId;
    jsonObj[JsonKey::USER_IP] = m_requestUserIp;
    return jsonObj;
}

UserId VideoRequestToClient::getRequestUserId() const
{
    return m_requestUserId;
}

Ip VideoRequestToClient::getRequestUserIp() const
{
    return m_requestUserIp;
}
